package com.cn.study0014.test005;

/**
 * @author lw
 * @ClassName ComResults.java
 * @Description
 * @createTime 2023年05月18日 15:22:00
 */
public class ComResults {
    /**
     * 求平均成绩
     * @param scores
     * @return
     */
    public double calAvg(int[] scores){
        int sum = 0;
        double avg=0.0;
        for (int i = 0; i <scores.length ; i++) {
            sum+=scores[i];
        }
        avg=(double)sum/scores.length;
        return avg;
    }
    /**
     * 求最大值
     * @param scores
     * @return
     */
    public int maxNum(int[] scores){
        int max=scores[0];
        for (int i = 0; i <scores.length ; i++) {
            if (max<scores[i]){
                max=scores[i];
            }
        }
        return max;
    }

}
